<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
${aier_doctype}
<html <s:property value="aier-html-xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="stylesheet" href="${aier_css_url}jc/chosen.css">
<link rel="stylesheet" href="${aier_css_url}jp/msg.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet" href="${aier_css_url}social/school/smanage.css" />


<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}ui.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/ja.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}social/school/iccardrecord.js"></script>
<script type="text/javascript">
	var global_suffix = "${aier_suffix}", global_url = "${aier_url}", global_uri = "${aier_uri}", global_urijs = "${aier_urijs}",
	 global_sid = "${sid}",global_userin_url = "${video_user_in_url}",global_userout_url = "${video_user_out_url}"; 
	
</script>
</head>
<!-- 学生进出园记录页面 -->
<body>
	<!-- 顶栏 -->
	<s:action name="userhomecomm_homeHead" namespace="/user"
		executeResult="true"></s:action>

	<!-- 正文 -->
	<div id="hfContent" class="ar-content">
		<div class="content-main">
			<!-- 学校名称栏 -->
			<s:action name="scomm_schoolMTitle" namespace="/school"
				executeResult="true"></s:action>
			<div class="main-content wrap-bg clearfix">
				<!-- 左侧栏 -->
				<s:action name="scomm_schoolMLeft" namespace="/school"
					executeResult="true"></s:action>
				<!-- 右侧内容 -->
				<div class="ae-right">
					<div class="right-main">
						<div class="right-main-top">
							<div class="binfo-title">
								<h3>打卡记录</h3>
							</div>
							<div class="right-line"></div>
						</div>
						<div class="right-main-c">
						
						    <div id="tabsCm">
						        <ul>
                                    <li><a href="#tabs-2">教师考勤</a>
                                    </li>
                                    <li><a href="#tabs-1" onclick="showStuRecord()">学生打卡记录</a> 
                                    </li>
                                </ul>
                                <div id="tabs-1">
	                                <div class="info-tab01">
		                                <table>
		                                    <tr>
		                                        <th class="gray6">时间：</th>
		                                        <td><input type="text" id="dayValue" class="PY-input"
		                                            onfocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'%y-%M-%d'})" />
		                                        </td>
		                                        <th class="gray6">班级选择：</th>
	                                                <td><select id="classid" class="chosen">
	                                                        <option value="-1">所有班级</option>
	                                                        <c:forEach var="cls" items="${schoolClassList }">
	                                                            <option value="${cls.cid}">${cls.cname}</option>
	                                                        </c:forEach>
	                                                </select>
	                                                </td>
		                                         <td colspan="2" align="right"><a id="b_hmsel"
	                                                   onclick="show_stu_record()" href="javascript:;"
	                                                   class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr"
	                                                   role="button" aria-disabled="false"><span
	                                                       class="ui-button-text">查询</span> </a></td>
		                                    </tr>
		                                </table>
			                            
		                            </div>
		                            <div class="right-main-down">
                                        <div class="down-line"></div>
            
                                        <div class="down-inre">
                                            <table id="inOutParkInfo"></table>
                                            <div id="inOutParkPage"></div>
                                        </div>
                                    </div>
                                </div>
                                <div id="tabs-2">
                                    <div class="info-tab01">
                                        <div class="gray6">查询方式：</div>
                                        <div style="margin-left: 30px;margin-top: 10px;">
                                            <input name="type" type="radio" id="day" checked="checked" onclick="changeType(1);"><label
                                                    for="day">每日考勤:</label>
                                            <label style="margin-left: 10px;">时间</label>
                                            <input type="text" id="dayValueTea" class="PY-input" style="font-size: 11px;"
                                                    onfocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'%y-%M-%d'})" />
                                        </div>
                                        <div style="margin-left: 30px; margin-top: 5px;">
                                            <input name="type" type="radio" id="person" onclick="changeType(2);"><label
                                                   for="person">每人每月:</label>
                                            <label style="margin-left: 10px;">月份</label>
                                            <input type="text" id="monthTea" class="PY-input" style="font-size: 11px;"
                                                    onfocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM',readOnly:true,maxDate:'%y-%M-%d'})" />
                                            <label style="margin-left: 10px;">姓名与帐号</label>
                                            <s:select id="adTname" list="tnameAccountList"
                                                            data-placeholder="请选择或输入姓名与账号" cssClass="chosen"
                                                            tabindex="4">
                                            </s:select>
                                        </div>
                                        <div style="margin-left: 500px;">
                                            <a onclick="show_tea_record()" href="javascript:;"
                                               class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr"
                                               role="button" aria-disabled="false"><span
                                                   class="ui-button-text">查询</span> </a>
                                            <a onclick="downExcle()" href="javascript:;"
                                            class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr"
                                            role="button" aria-disabled="false"><span
                                                class="ui-button-text">导出Excel</span> </a>
                                        </div>
		                            </div>
		                            <div class="right-main-down">
		                                <div class="down-line"></div>
		    
		                                <div class="down-inre">
		                                    <table id="tea_inOutParkInfo"></table>
		                                    <div id="tea_inOutParkPage"></div>
		                                </div>
		                            </div>
                                </div>
                                
						    </div>
	                        
						</div>
					</div>
				</div>

			</div>

		</div>
		<!-- footer copyright -->
		<s:action name="userhomecomm_homeFooter" namespace="/user"
			executeResult="true"></s:action>
		<!-- /footer copyright -->
	</div>
</body>
<script type="text/javascript">
    $("#tabsCm").tabs();
	$(".chosen").chosen();
	function changeType(type) {
		if (type == 1) {
			$("#daytr").css("display","block");
			$("#persontr").css("display","none");
		} else {
			$("#daytr").css("display","none");
            $("#persontr").css("display","block");
		}
	}
	//补0函数
	function appendZero(s){
		return ("00"+ s).substr((s+"").length);
	}  
	
	function show_stu_record(){
		var cid = $('#classid  option:selected').val();
	    var dayValue = $('#dayValue').val();
		jQuery("#inOutParkInfo")
				.jqGrid(
						'setGridParam',
						{
							url : "${aier_url}${aier_urijs}schooliccard_searchUIIList${aier_suffix}?sid="
									+ global_sid
									+ "&cid="+cid
									+ "&dayValue="
									+ dayValue,
							page : 1
						}).trigger("reloadGrid");
	}
	
	function show_tea_record() {
		var type;
		var dayValue;
		var account;
		if ($('#day').attr("checked") == "checked") {
			type = 1;
			dayValue = $('#dayValueTea').val();
			jQuery("#tea_inOutParkInfo").jqGrid("setLabel", "name","教师姓名");


        } else {
        	type = 2;
        	dayValue = $('#monthTea').val();
            var nameAndAccount = $("#adTname").val();
            if(nameAndAccount=="所有教师"){
                $().message("请选择教师");
                return;
            }
            account = nameAndAccount.split(" ")[1];
            jQuery("#tea_inOutParkInfo").jqGrid("setLabel", "name","日期");

        }
		
		jQuery("#tea_inOutParkInfo").jqGrid(
                'setGridParam',
                {
                    url : "${aier_url}${aier_urijs}schooliccard_searchTIIList${aier_suffix}?sid="
                            + global_sid
                            + "&dayValue="
                            + dayValue
                            + "&account="
                            + account
                            + "&type="
                            + type,
                    page : 1
                }).trigger("reloadGrid");
	}
	
	// 下载excel
	function downExcle() {
		var type;
        var dayValue;
        var account;
        var tname;
        if ($('#day').attr("checked") == "checked") {
            type = 1;
            dayValue = $('#dayValueTea').val();
        } else {
            type = 2;
            dayValue = $('#monthTea').val();
            var nameAndAccount = $("#adTname").val();
            if(nameAndAccount=="所有教师"){
                $().message("请选择教师");
                return;
            }
            account = nameAndAccount.split(" ")[1];
            tname = nameAndAccount.split(" ")[0];
        }
        
        window.open("${aier_url}${aier_uri}schooliccard_down${aier_suffix}?sid="
                + global_sid + "&dayValue=" + dayValue + "&account=" + account
                + "&type=" + type + "&tname=" + tname);
		
	}
	
</script>
</html>